<meta charset="UTF-8">
<?php
include_once("../functions/db_manipulate.php");

if (!init()) {
    redirect("../login.php");
}
connectDB();

startTransaction();

$restoreUserRes = mysql_query("DELETE FROM deleteusers WHERE userid='" . $_SESSION['id'] . "'") or die(mysql_error());

$visResultSet = mysql_query("UPDATE users SET visible = '1' WHERE id='" . $_SESSION['id'] . "'") or die(mysql_error());

if ($restoreUserRes && $visResultSet) {
    commitTransaction();
    redirect($_SERVER['HTTP_REFERER']);
} else {
    rollbackTransaction();
}

?>

